<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('功能配置新增及修改')" />
	<style type="text/css">
		.layui-input, .layui-textarea{width:calc(100% - 100px);}
		.layui-form-label{width:180px}
		.layui-form-select dl{margin-left:80px;min-width: calc(100% - 100px);}
		.layui-edge{margin-right:28px;}
	</style>
</head>
<body>
<form class="layui-form" id="form-dict-add" style="padding: 16px 84px 16px 25px;">
<input type="hidden" id="guid" name="guid"  th:value="${dictionaryForModule?.guid}">
<div class="">
	<div class="layui-form-item">
	<label class="layui-form-label">功能名称：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleName" id="moduleName" th:value="${dictionaryForModule?.moduleName}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item">
	<label class="layui-form-label">功能别名：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleAlias" id="moduleAlias" th:value="${dictionaryForModule?.moduleAlias}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item">
	<label class="layui-form-label">功能唯一标识：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleTable" id="moduleTable" th:value="${dictionaryForModule?.moduleTable}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item">
	<label class="layui-form-label">查询功能地址：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleurl1" id="moduleurl1" th:value="${dictionaryForModule?.moduleurl1}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item">
	<label class="layui-form-label">制单功能地址：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleurl2" id="moduleurl2" th:value="${dictionaryForModule?.moduleurl2}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item">
	<label class="layui-form-label">功用状态：</label>
	<div class="layui-input-block">
		<input type="radio" name="moduleState" value="1" title="启用" checked>
		<input type="radio" name="moduleState" value="0" title="停用" th:checked="${dictionaryForModule?.moduleState== '0'}? true : false">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">控制器名称：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleController" id="moduleController" th:value="${dictionaryForModule?.moduleController}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">主数据表名：</label>
	<div class="layui-input-block">
		<input type="text" name="dataBaseTable" id="dataBaseTable" th:value="${dictionaryForModule?.dataBaseTable}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">指定菜单：</label>
	<div class="layui-input-block">
		<select name="menuGuid" id="menuGuid" lay-search>
			<option value="">请选择</option>
			<option th:each="nextMenuMap:${nextMenuMap}" th:value="${nextMenuMap.value.guid}"  th:text="${nextMenuMap.key}" th:selected="${nextMenuMap.value.guid} eq ${dictionaryForModule?.menuGuid}"></option>
		</select>
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">功能分组：</label>
	<div class="layui-input-block">
		<select name="moduleGroup" id="moduleGroup" th:with="type=${@baseinfosimple.getBaseInfoSimpleData('modulegroup')}">
			<option value="">请选择</option>
			<option th:each="dict : ${type}" th:text="${dict.vname}" th:data-guid="${dict.guid}" th:value="${dict.vid}" th:selected="${dict.vid} eq ${dictionaryForModule?.moduleGroup}"></option>
		</select>
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">手机分组：</label>
	<div class="layui-input-block">
		<select name="mobileGroup" id="mobileGroup" th:with="type=${@baseinfosimple.getBaseInfoSimpleData('mobilegroup')}">
			<option value="">请选择</option>
			<option th:each="dict : ${type}" th:text="${dict.vname}" th:data-guid="${dict.guid}" th:value="${dict.vid}" th:selected="${dict.vid} eq ${dictionaryForModule?.mobileGroup}"></option>
		</select>
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">单号序列初始值：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleSequence" id="moduleSequence" th:value="${dictionaryForModule}?${dictionaryForModule.moduleSequence}:1001" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item">
	<label class="layui-form-label">系统单号头：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleNid" id="moduleNid" th:value="${dictionaryForModule?.moduleNid}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">自定义单号：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleBid" id="moduleBid" th:value="${dictionaryForModule?.moduleBid}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">使用单号连接符：</label>
	<div class="layui-input-block">
		<input type="radio" name="moduleBidAddCon" value="0" title="否" checked>
		<input type="radio" name="moduleBidAddCon" value="1" title="是" th:checked="${dictionaryForModule?.moduleBidAddCon}">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">最长允许修改天数：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleChangeTimeLimit" id="moduleChangeTimeLimit" th:value="${dictionaryForModule}? ${dictionaryForModule.moduleChangeTimeLimit}:90" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">功能级别：</label>
		<div class="layui-input-block">
			<select name="moduleLevel" id="moduleLevel" th:valuecn="${dictionaryForModule?.moduleLevel}">
					<option value="">请选择</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">功能排序：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleOrder" id="moduleOrder" th:value="${dictionaryForModule}?${dictionaryForModule.moduleOrder}:1" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">权限标识前缀：</label>
	<div class="layui-input-block">
		<input type="text" name="shiroSign" id="shiroSign" th:valuecn="${dictionaryForModule?.shiroSignList}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">是否身份验证：</label>
	<div class="layui-input-block">
		<select name="passwordAuthentication" id="passwordAuthentication">
			<option value="">请选择</option>
			<option th:each="act:${authenticationType}" th:value="${act.key}"  th:text="${act.value}" th:selected="${act.key} eq ${dictionaryForModule?.passwordAuthentication}"></option>
		</select>
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">默认查询条件：</label>
	<div class="layui-input-block">
		<input type="text" name="moduleWhereStr" id="moduleWhereStr" th:value="${dictionaryForModule?.moduleWhereStr}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
	</div>
	</div>
	<div class="layui-form-item layui-form-text">
	<label class="layui-form-label">菜单图标：</label>
	<div class="layui-input-block">
	<input type="text" name="moduleICON" id="moduleICON" th:value="${dictionaryForModule?.moduleICON}" lay-verify="required" autocomplete="off" placeholder="请选择" class="layui-input">
	<div style="width: 80%;margin-left: 10%">
		<div id="icondiv" style="display: none;max-height:200px;overflow-y:auto">
			<div th:include="system/menu/menu_icon"></div>
		</div>
	</div>
	</div>
	</div>
</div>
</form>
<th:block th:include="include :: footer" />
<script type="text/javascript">
var prefix = ctx + "system/dictionaryformodule";
var $,layer,form;
layui.use(['form','layer','jquery'], function () {
	$ = layui.$,layer = layui.layer,form = layui.form;
	//功能级别0-10
	for (var i = 0; i < 11; i++) {
		$('#moduleLevel').append(new Option(i,i));
	}
	//下拉框赋值
	if($('#moduleLevel').attr("valuecn")){
		$('#moduleLevel').val($('#moduleLevel').attr("valuecn"));
	}
	//权限标识前缀
	if($('#shiroSign').attr("valuecn")){
		$('#shiroSign').val($('#shiroSign').attr("valuecn").split(":list")[0]);
	}
	form.render();
	//图标块的显示隐藏
	$("#moduleICON").focus(function() {
		$("#icondiv").show();
	});
	$("#icondiv").find(".ico-list i").on("click", function() {
		$('#moduleICON').val($(this).attr('class'));
		$("#icondiv").hide();
	});
});
//提交调用的方法
function submitHandler(index, layero) {
	if($('#guid').val()){//通过判断guid是否存在来判断是新增还是保存
		if ($.validate.form()) {
			$.operate.post(prefix + "/editpost", {'dictionaryForModuleItems':JSON.stringify([$.common.formToJSON('form-dict-add')])},function(res){
				if(res.code == 0){
					setTimeout(function(){
						parent.table.reload('dhtable');
						parent.layer.close(index);//在父窗口调用layer关闭当前窗口
					}, 1500);
				}
			});
		}
	}else{
		if ($.validate.form()) {
			$.operate.post(prefix + "/addpost", {'dictionaryForModuleItems':JSON.stringify([$.common.formToJSON('form-dict-add')])},function(res){
				if(res.code == 0){
					setTimeout(function(){
						parent.table.reload('dhtable');
						parent.layer.close(index);//在父窗口调用layer关闭当前窗口
					}, 1500);
				}
			});
		}
	}
}
</script>
</body>
</html>
